<%--
  Created by IntelliJ IDEA.
  User: leixiaolong
  Date: 2018/12/1
  Time: 12:26 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>菜单详情</title>
    <link rel="stylesheet" href="/static/css/rpt-condition.css" media="all" type="text/css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/layui/css/layui.css" media="all" type="text/css">
</head>
<style>
    .dom-input {
        min-height: 30px;
        margin-top: 10px;
        text-align: left;
    }
</style>
<body>
<div>
    <div class="layui-form" lay-filter="menu_form">
        <div>
            <div class="layui-form-item">
                <label class="layui-form-label">菜单ID：</label>
                <input type="text" class="layui-input-inline dom-input" id="menu_id" name="menuId">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">菜单名称：</label>
                <input type="text" class="layui-input-inline dom-input" id="menu_name" name="menuName">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">菜单URL：</label>
                <input type="text" class="layui-input-inline dom-input" id="menu_url" name="menuUrl">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">菜单类型：</label>
                <input type="text" class="layui-input-inline dom-input" id="menu_type" name="menuType">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">菜单描述：</label>
                <input type="text" class="layui-input-inline dom-input" id="menu_desc" name="menuDesc">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">菜单序号：</label>
                <input type="text" class="layui-input-inline dom-input" id="menu_no" name="menuNo">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">父菜单：</label>
                <input type="text" class="layui-input-inline dom-input" id="father_menu_name" name="fatherMenuName">
            </div>
        </div>
    </div>
</div>
</body>
</html>

<script language='javascript' src="${pageContext.request.contextPath}/plugins/layui/layui.js"></script>
<script language='javascript' src="${pageContext.request.contextPath}/static/js/component/form-select.js"></script>
<script language='javascript' src="${pageContext.request.contextPath}/static/js/component/form-date.js"></script>
<script language='javascript' src="${pageContext.request.contextPath}/static/js/utils/moment.js"></script>

<script>
    layui.use(["form", "jquery"], function () {
        var form = layui.form, $ = layui.jquery;

        var getUrlParam = function (name) {
            var url = location.search;
            url = url.substring(url.indexOf("?"));
            if (url.indexOf("?") != -1) {
                var str = url.substr(1);
                strs = str.split("&");
                for (var i = 0; i < strs.length; i++) {
                    if (name == strs[i].split("=")[0]) {
                        return unescape(strs[i].split("=")[1]);
                    }
                }
            }
            return "";
        }

        var nodeId = getUrlParam("nodeId"),
            parentId = getUrlParam("parentId"),
            context = decodeURI(getUrlParam("context")),  // 注意，此处对context做了一次转码
            isLeaf = getUrlParam("isLeaf"),
            level = getUrlParam("level"),
            spread = getUrlParam("spread"),

            basicStr = decodeURI(getUrlParam("basicData"));
        var basicData = {};
        debugger
        if (basicStr != null && typeof(basicStr) != 'undefined' && basicStr != '') {
            basicData = JSON.parse(basicStr);
        }

        // 赋值
        form.val("menu_form", {
            "nodeId": nodeId,
            "parentId": parentId,
            "context": context,
            "isLeaf": isLeaf,
            "level": level,
            "spread": spread,
            "menuId": nodeId,
            "menuName": basicData.menuName,
            "menuUrl": basicData.menuUrl,
            "menuType": basicData.menuType,
            "menuDesc": basicData.menuDesc,
            "menuNo": basicData.menuNo,
            "fatherMenuName": basicData.fatherMenuName
        });
        form.render(); //刷新表单
    });


</script>
